﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
	<!--Button in Scroll Control Style-->
  <ControlTemplate x:Key="ScrollButtonControlTemplate" TargetType="{x:Type RepeatButton}">
		<Border x:Name="border" BorderThickness="1" CornerRadius="2" BorderBrush="{DynamicResource ScrollViewerButtonBorderBrush}" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{DynamicResource ScrollViewerButtonBackgroundBrush}">
  		<Border x:Name="border1" Height="Auto" BorderBrush="{DynamicResource TransparentBrush}" BorderThickness="1" CornerRadius="2" Background="{DynamicResource TransparentBrush}">
  			<Grid Height="Auto">
  				<Rectangle x:Name="rectangle" StrokeThickness="0" Visibility="Collapsed">
  					<Rectangle.Fill>
  						<RadialGradientBrush Center="0.503,1" GradientOrigin="0.503,1" RadiusY="0.202">
  							<GradientStop Color="#7FFFFFFF" Offset="0"/>
  							<GradientStop Offset="1"/>
  						</RadialGradientBrush>
  					</Rectangle.Fill>
  				</Rectangle>
  				<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
  			</Grid>
  		</Border>
  	</Border>
		<ControlTemplate.Triggers>
			<Trigger Property="IsMouseOver" Value="False"/>			
			<Trigger Property="IsPressed" Value="True">
				<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonPressedOuterBorderBrush}"/>
				<Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonPressedOuterBackgroundBrush}"/>
				<Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonPressedInnerBackgroundBrush}"/>
				<Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonPressedInnerBorderBrush}"/>
			</Trigger>
			<Trigger Property="IsEnabled" Value="False">
			</Trigger>
			<MultiTrigger>
				<MultiTrigger.Conditions>
					<Condition Property="IsMouseOver" Value="True"/>
					<Condition Property="IsPressed" Value="False"/>
				</MultiTrigger.Conditions>
				<Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBorderBrush}"/>
				<Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBackgroundBrush}"/>
				<Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonHoverOuterBackgroundBrush}"/>
				<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonHoverOuterBorderBrush}"/>
				<Setter Property="Visibility" TargetName="rectangle" Value="Visible"/>
			</MultiTrigger>
			<MultiTrigger>
				<MultiTrigger.Conditions>
					<Condition Property="IsKeyboardFocusWithin" Value="True"/>
					<Condition Property="IsPressed" Value="False"/>
				</MultiTrigger.Conditions>
				<Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBorderBrush}"/>
				<Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBackgroundBrush}"/>
				<Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonHoverOuterBackgroundBrush}"/>
				<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonHoverOuterBorderBrush}"/>
			</MultiTrigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>
  <Style x:Key="ScrollButtonStyle" TargetType="{x:Type RepeatButton}">
    <Setter Property="Template" Value="{StaticResource ScrollButtonControlTemplate}"/>
    <Setter Property="Foreground" Value="{DynamicResource DefaultFontBrush}"/>
    <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}"/>
  </Style>    
  <MenuScrollingVisibilityConverter x:Key="MenuScrollingVisibilityConverter"/>
  <Style x:Key="RibbonScrollViewer" TargetType="{x:Type ScrollViewer}">
    <Setter Property="OverridesDefaultStyle" Value="True"/>
	<Setter Property="FocusManager.IsFocusScope" Value="False"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ScrollViewer}">
<Grid x:Name="Grid" Background="{TemplateBinding Background}" IsHitTestVisible="True">            
            <ScrollContentPresenter  Margin="{TemplateBinding Padding}" x:Name="PART_ScrollContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CanContentScroll="{TemplateBinding CanContentScroll}" IsHitTestVisible="True" />
            <RepeatButton
                                      
                                      Command="{x:Static ScrollBar.LineLeftCommand}"
                                      CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                      Focusable="false" HorizontalAlignment="Left" Width="13" Height="Auto" VerticalAlignment="Stretch" Style="{StaticResource ScrollButtonStyle}">
                <RepeatButton.Visibility>
                    <MultiBinding FallbackValue="Visibility.Collapsed"
                                              Converter="{StaticResource MenuScrollingVisibilityConverter}"
                                              ConverterParameter="0">
                        <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="ComputedHorizontalScrollBarVisibility"/>
                        <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="HorizontalOffset"/>
                        <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="ExtentWidth"/>
                        <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="ViewportWidth"/>
                    </MultiBinding>
                </RepeatButton.Visibility>
            	<Path Fill="Black" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="3" Height="5" Data="M0,0L1,1 1,-1z"/>
            </RepeatButton>
            <RepeatButton
                                      
                                      Command="{x:Static ScrollBar.LineRightCommand}"
                                      CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                      Focusable="false" HorizontalAlignment="Right" Width="13" Height="Auto" VerticalAlignment="Stretch" Style="{StaticResource ScrollButtonStyle}">
                <RepeatButton.Visibility>
                    <MultiBinding FallbackValue="Visibility.Collapsed"
                                              Converter="{StaticResource MenuScrollingVisibilityConverter}"
                                              ConverterParameter="100">
                        <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="ComputedHorizontalScrollBarVisibility"/>
                        <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="HorizontalOffset"/>
                        <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="ExtentWidth"/>
                        <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="ViewportWidth"/>
                    </MultiBinding>
                </RepeatButton.Visibility>
            	<Path Fill="Black" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="3" Height="5" Data="M1,0L0,1 0,-1z"/>
            </RepeatButton>
        </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="CanContentScroll" Value="True"/>
    <Setter Property="HorizontalScrollBarVisibility" Value="Auto"/>
    <Setter Property="VerticalScrollBarVisibility" Value="Disabled"/>
    <Setter Property="Focusable" Value="False"/>
  </Style>
  <Style x:Key="RibbonTabScrollViewer" TargetType="{x:Type ScrollViewer}">
    <Setter Property="OverridesDefaultStyle" Value="True"/>
	<Setter Property="FocusManager.IsFocusScope" Value="False"/>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ScrollViewer}">
<Grid x:Name="Grid" Background="{TemplateBinding Background}" IsHitTestVisible="True">            
            <ScrollContentPresenter  Margin="{TemplateBinding Padding}" x:Name="PART_ScrollContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" CanContentScroll="{TemplateBinding CanContentScroll}" IsHitTestVisible="True" />
            <RepeatButton
                                      
                                      Command="{x:Static ScrollBar.LineLeftCommand}"
                                      CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                      Focusable="false" HorizontalAlignment="Left" Width="13" Height="Auto" VerticalAlignment="Stretch" Style="{StaticResource ScrollButtonStyle}" Margin="0,7,0,1">
                <RepeatButton.Visibility>
                    <MultiBinding FallbackValue="Visibility.Collapsed"
                                              Converter="{StaticResource MenuScrollingVisibilityConverter}"
                                              ConverterParameter="0">
                        <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="ComputedHorizontalScrollBarVisibility"/>
                        <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="HorizontalOffset"/>
                        <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="ExtentWidth"/>
                        <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="ViewportWidth"/>
                    </MultiBinding>
                </RepeatButton.Visibility>
            	<Path Fill="Black" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="3" Height="5" Data="M0,0L1,1 1,-1z"/>
            </RepeatButton>
            <RepeatButton
                                      
                                      Command="{x:Static ScrollBar.LineRightCommand}"
                                      CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                      Focusable="false" HorizontalAlignment="Right" Width="13" Height="Auto" VerticalAlignment="Stretch" Style="{StaticResource ScrollButtonStyle}" Margin="0,7,0,1">
                <RepeatButton.Visibility>
                    <MultiBinding FallbackValue="Visibility.Collapsed"
                                              Converter="{StaticResource MenuScrollingVisibilityConverter}"
                                              ConverterParameter="100">
                        <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="ComputedHorizontalScrollBarVisibility"/>
                        <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="HorizontalOffset"/>
                        <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="ExtentWidth"/>
                        <Binding RelativeSource="{RelativeSource TemplatedParent}"
                                             Path="ViewportWidth"/>
                    </MultiBinding>
                </RepeatButton.Visibility>
            	<Path Fill="Black" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center" Width="3" Height="5" Data="M1,0L0,1 0,-1z"/>
            </RepeatButton>
        </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Setter Property="CanContentScroll" Value="True"/>
    <Setter Property="HorizontalScrollBarVisibility" Value="Auto"/>
    <Setter Property="VerticalScrollBarVisibility" Value="Disabled"/>
    <Setter Property="Focusable" Value="False"/>
    
  </Style>
</ResourceDictionary>